import java.util.ArrayList;

/**
 * Created by Cameron on 2/6/14.
 */
public class GetPrimeFactors {

    private boolean isPrime(int n) {
        boolean isPrime = true;
        for(int i=2; i< (n/2); i++) {
            if (n % i == 0)
                isPrime = false;
        }
        return isPrime;
    }

    ArrayList<Integer> generate(int n) {
        ArrayList<Integer> primeFactors = new ArrayList<Integer>();

        for(int i=2; i<n-1; i++) {
            if (n % i == 0) {
                if (isPrime(i))
                    primeFactors.add(i);
            }
        }
        return primeFactors;
    }

    public static void main (String[] args) {
        GetPrimeFactors gpf = new GetPrimeFactors();

        ArrayList<Integer> primeFactors = gpf.generate(1);
        System.out.println(primeFactors.toString());

        primeFactors = gpf.generate(30);
        System.out.println(primeFactors.toString());
    }
}
